import java.util.Scanner;


class Scarecrow {
	public static void main(String[] args) {

	      Scanner scanner = new Scanner(System.in);

	      int n = scanner.nextInt() ;
	      
	      for(int i=0;i<n;i++)
	      {
	    	  int len ;
	    	  len = scanner.nextInt();
	    	  String farms = scanner.next() ;
	    	  int ct = 0 ;
	    	  for(int j=0;j<len;)
	    	  {
	    		  if(farms.charAt(j)=='#')
	    		  {
	    			  j++ ;
	    			  
	    		  }
	    		  else
	    		  {
	    			  ct++ ;
	    			  j+=3 ;
	    		  }
	    	  }
	    	  System.out.println("Case "+(i+1)+": "+ct) ;
	      }
	      // close the scanner
	      scanner.close();
	   }
}
